﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPageAdmin.master" AutoEventWireup="true" CodeFile="Program.aspx.cs" Inherits="Admin_Program" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">

        .style10
        {
            width: 471px;
            text-align: center;
        }
        .style9
        {
            width: 23px;
        }
        .style8
        {
            text-align: center;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="style7">
        <tr>
            <td colspan="3" style="text-align: center">
                <asp:Label ID="Label1" runat="server" Text="Program" 
                    style="font-weight: 700; color: #0066FF;"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style10">
                &nbsp;</td>
            <td class="style9">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="3" style="text-align: center">
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" CellPadding="4" DataKeyNames="programId" 
                    DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" 
                    onselectedindexchanged="GridView1_SelectedIndexChanged">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                        <asp:BoundField DataField="programId" HeaderText="ID" InsertVisible="False" 
                            ReadOnly="True" SortExpression="programId" />
                        <asp:BoundField DataField="programName" HeaderText="Program Name" 
                            SortExpression="programName" />
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                    DeleteCommand="DELETE FROM [tblProgram] WHERE [programId] = @programId" 
                    InsertCommand="INSERT INTO [tblProgram] ([programName]) VALUES (@programName)" 
                    SelectCommand="SELECT * FROM [tblProgram]" 
                    UpdateCommand="UPDATE [tblProgram] SET [programName] = @programName WHERE [programId] = @programId">
                    <DeleteParameters>
                        <asp:ControlParameter ControlID="TextBox1" Name="programId" PropertyName="Text" 
                            Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:ControlParameter ControlID="TextBox2" Name="programName" 
                            PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="TextBox1" Name="programId" 
                            PropertyName="Text" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="programName" Type="String" />
                    </InsertParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td class="style10">
                &nbsp;</td>
            <td class="style9">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style8" colspan="3">
                <asp:Button ID="btnAdd" runat="server" onclick="Button1_Click" Text="Add" />
&nbsp;
                <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Edit" />
&nbsp;
                <asp:Button ID="Button3" runat="server" Text="Delete" onclick="Button3_Click" />
            </td>
        </tr>
        <tr>
            <td class="style10">
                <asp:Label ID="Label2" runat="server" Text="Id" Visible="False"></asp:Label>
            </td>
            <td class="style9">
                &nbsp;</td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style10">
                <asp:Label ID="Label3" runat="server" Text="Name" Visible="False"></asp:Label>
            </td>
            <td class="style9">
                &nbsp;</td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style10">
                &nbsp;</td>
            <td class="style9">
                &nbsp;</td>
            <td>
                <asp:Button ID="btnEdit" runat="server" onclick="Button4_Click" Text="Edit" 
                    Visible="False" />
            </td>
        </tr>
        <tr>
            <td class="style10">
                &nbsp;</td>
            <td class="style9">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
</asp:Content>

